<?php

namespace App\Jobs\Train\Snap;

use App\Models\Train\TrainOrders\TrainOrder;
use App\Trip\Tencent\Cloud\SDK\TCCC\Tccc;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;

class ProcessSnapTicketSuccess implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct(TrainOrder $order)
    {
        $this->order = $order;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        $tccc        = new Tccc();
        $business_id = config('qcloud.tccc.business.train_snap_success');
        if ($business_id) {
            $mobile = $this->order->getMobile();
            $tccc->createAutoCalloutTask([
                'business_id' => $business_id,
                'mobile'      => $mobile,
            ]);
        }
    }
}
